package org.doubango.FrCall.Utils;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.view.View;

public class DialogUtil {

	public static Dialog openMsgDialog(Activity act, int icon, int title,
			int okTxt, DialogInterface.OnClickListener okListener) {
		return new AlertDialog.Builder(act).setIcon(icon).setTitle(title)
				.setPositiveButton(okTxt, okListener).create();
	}

	public static Dialog openMsgDialog(Activity act, int icon, String title,
			String okTxt, DialogInterface.OnClickListener okListener) {
		return new AlertDialog.Builder(act).setIcon(icon).setTitle(title)
				.setPositiveButton(okTxt, okListener).create();
	}

	public static Dialog openMsgDialog(Activity act, int icon, int title,
			int okTxt, int cancelTxt,
			DialogInterface.OnClickListener okListener,
			DialogInterface.OnClickListener cancelListener) {
		return new AlertDialog.Builder(act).setIcon(icon).setTitle(title)
				.setPositiveButton(okTxt, okListener)
				.setNegativeButton(cancelTxt, cancelListener).create();
	}

	public static Dialog openMsgDialog(Activity act, int icon, String title,
			String okTxt, String cancelTxt,
			DialogInterface.OnClickListener okListener,
			DialogInterface.OnClickListener cancelListener) {
		return new AlertDialog.Builder(act).setIcon(icon).setTitle(title)
				.setPositiveButton(okTxt, okListener)
				.setNegativeButton(cancelTxt, cancelListener).create();
	}

	public static Dialog openLongMsgDialog(Activity act, int icon,
			String title, String msg, String okTxt, String cancelTxt,
			DialogInterface.OnClickListener okListener,
			DialogInterface.OnClickListener cancelListener) {
		return new AlertDialog.Builder(act).setIcon(icon).setTitle(title)
				.setMessage(msg).setPositiveButton(okTxt, okListener)
				.setNegativeButton(cancelTxt, cancelListener).create();
	}

	public static Dialog openListDialog(Activity act, int icon, String title,
			String[] items, DialogInterface.OnClickListener listener) {
		return new AlertDialog.Builder(act).setIcon(icon).setTitle(title)
				.setItems(items, listener).create();
	}

	public static Dialog openSingleChoiceDialog(Activity act, int icon,
			String title, String[] items, int checkedItem, String okTxt, String cancelTxt,
			DialogInterface.OnClickListener listener,
			DialogInterface.OnClickListener okListener,
			DialogInterface.OnClickListener cancelListener) {
		return new AlertDialog.Builder(act).setIcon(icon).setTitle(title)
				.setSingleChoiceItems(items, checkedItem, listener)
				.setPositiveButton(okTxt, okListener)
				.setNegativeButton(cancelTxt, cancelListener).create();
	}

	public static Dialog openMultChoiceDialog(Activity act, int icon,
			String title, String[] items, boolean[] defaultValues,
			String okTxt, String cancelTxt,
			DialogInterface.OnMultiChoiceClickListener listener,
			DialogInterface.OnClickListener okListener,
			DialogInterface.OnClickListener cancelListener) {
		return new AlertDialog.Builder(act).setIcon(icon).setTitle(title)
				.setMultiChoiceItems(items, defaultValues, listener)
				.setPositiveButton(okTxt, okListener)
				.setNegativeButton(cancelTxt, cancelListener).create();
	}

	public static Dialog openViewDialog(Activity act, int icon, String title,
			View view, String okTxt, String cancelTxt,
			DialogInterface.OnClickListener okListener,
			DialogInterface.OnClickListener cancelListener) {
		return new AlertDialog.Builder(act).setIcon(icon).setTitle(title)
				.setView(view).setPositiveButton(okTxt, okListener)
				.setNegativeButton(cancelTxt, cancelListener).create();
	}

	public static Dialog openViewDialog(Activity act, int icon, int title,
			View view, int okTxt, int cancelTxt,
			DialogInterface.OnClickListener okListener,
			DialogInterface.OnClickListener cancelListener) {
		return new AlertDialog.Builder(act).setIcon(icon).setTitle(title)
				.setView(view).setPositiveButton(okTxt, okListener)
				.setNegativeButton(cancelTxt, cancelListener).create();
	}

}
